<?=view('admin.common.header')?>
<?=view('admin.common.nav')?>
<div class="container">
    <div class="row">
        <div class="panel panel-default">
            <div class="panel-heading">
                添加反馈问题原因
            </div>
            <div class="panel-body">
                <div class="col-xs-12 col-sm-12">
                    <form id="noticeadd" class="form-horizontal mtop15" method="post">
                        <div class="form-group">
                            <label for="" class="col-sm-2 control-label">原因</label>
                            <div class="col-sm-10">
                                <input type="text" value="" name="name" class="form-control" placeholder="--原因--" required="required">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button class="btn btn-success eveAdd" onclick="return false;">添加</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div> 
    </div>
</div>
<script>
    $('.eveAdd').click(function(){
        if ($(this).attr('disabled') ==  'disabled')
            return false;
        if (!(checkNull($("input[name=name]"), "请填内容"))) {
            return false;
        }
        $(this).attr('disabled', 'disabled');
        $('#noticeadd').ajaxSubmit(function(data){
            layer.msg(data.info);
            if (data.status == 1) {
                window.location.reload();
            } else if (data.status == 1) {
                $('.eveAdd').removeAttr('disabled');
            }
        });
    });
    
    function checkNull(elem, msg) {
        if (elem.val() == '') {
            layer.msg(msg);
            elem.focus();
            return false;
        }
        return true;
    }
</script>
<?=view('admin.common.footer')?>